//
//  SISSJsonRequestNetworkingManager+Progress.m
//  SISSAPP
//
//  Created by 优房网 on 2017/6/8.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSJsonRequestNetworkingManager+Progress.h"

@implementation SISSJsonRequestNetworkingManager (Progress)

/// 4.1.1 筛选房源进度
- (void)requestFilterHouseProgressWithParameters:(NSDictionary *)paramters success:(void (^)(NSArray<SISSHouseProgressModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kJsonRequestNetworkingManager POSTWithURLString:URL_PROGRESS_FILTER_HOUSE parameters:paramters success:^(id responseObject) {
        
        NSLog(@"4.1.1 筛选房源进度请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSHouseProgressModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.1.2 筛选/获取客源业务进度
- (void)requestFilterPassengerProgressWithParameters:(NSDictionary *)paramters success:(void (^)(NSArray<SISSPassengerProgressModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kJsonRequestNetworkingManager POSTWithURLString:URL_PROGRESS_FILTER_PASSENGER parameters:paramters success:^(id responseObject) {
        
        NSLog(@" 4.1.2 筛选/获取客源业务进度请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSPassengerProgressModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.1.3 筛选/获取房源合作业务进度
- (void)requestFilterHouseCooperationProgressWithParameters:(NSDictionary *)paramters success:(void (^)(NSArray<SISSHouseCoopProgressModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kJsonRequestNetworkingManager POSTWithURLString:URL_PROGRESS_FILTER_HOUSE_COOPERATION parameters:paramters success:^(id responseObject) {
        
        NSLog(@"4.1.3 筛选/获取房源合作业务进度请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSHouseCoopProgressModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.1.4 筛选/获取客源合作业务进度
- (void)requestFilterPassengerCooperationProgressWithParameters:(NSDictionary *)paramters success:(void (^)(NSArray<SISSPassengerCoopProgressModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kJsonRequestNetworkingManager POSTWithURLString:URL_PROGRESS_FILTER_PASSENGER_COOPERATION parameters:paramters success:^(id responseObject) {
        
        NSLog(@"4.1.4 筛选/获取客源合作业务进度请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSPassengerCoopProgressModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}


#pragma mark - 2.0

// 4.1.5 筛选出租进度
- (void)requestFilterRentOutProgressWithParameters:(NSDictionary *)paramters success:(void (^)(NSArray<SISSRentOutProgressModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kJsonRequestNetworkingManager POSTWithURLString:URL_PROGRESS_FILTER_RENTOUT parameters:paramters success:^(id responseObject) {
        
        NSLog(@"4.1.5 筛选出租进度: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSRentOutProgressModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.1.6 筛选租房进度
- (void)requestFilterTenantProgressWithParameters:(NSDictionary *)paramters success:(void (^)(NSArray<SISSTenantProgressModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kJsonRequestNetworkingManager POSTWithURLString:URL_PROGRESS_FILTER_TENANT parameters:paramters success:^(id responseObject) {
        
        NSLog(@"4.1.6 筛选租房进度: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSTenantProgressModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}


@end
